/* ============================================
   PSI Connect - Login & Context Selection
   Split-screen card design override
   ============================================ */

#new-user-button {
    display: none !important;
}

/* ============================================
   SHARED: Split-screen background
   ============================================ */
body.stws-index-background {
    background: linear-gradient(to right, #0d1b2e 50%, #eef1f5 50%);
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0 !important;
}

/* ============================================
   MAIN PAGE: Logo panel (fixed to viewport)
   ============================================ */
body > .stsoftwarelogo {
    position: fixed !important;
    left: 0 !important;
    top: 0 !important;
    width: 50vw !important;
    height: 100vh !important;
    padding: 0 !important;
    background-image: url('/img/login-background.png') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: cover !important;
}

/* Logo centered with 10% padding on all sides */
body > .stsoftwarelogo::before {
    content: '' !important;
    position: absolute !important;
    left: 10% !important;
    right: 10% !important;
    top: 10% !important;
    bottom: 10% !important;
    background-image: url('/img/logo.svg') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
}

body > .stsoftwarelogo img {
    display: none !important;
}

/* ============================================
   LOGIN FORM CARD
   ============================================ */
#login-form-wrapper {
    position: fixed !important;
    top: 50% !important;
    left: 75vw !important;
    transform: translate(-50%, -50%) !important;
    width: min(440px, 44vw) !important;
    min-width: 300px;
    background: #ffffff !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.14) !important;
    padding: 40px !important;
}

#login-form {
    padding: 0 !important;
}

#login-form > #title-seperator {
    display: none !important;
}

/* Login form header: hide "Login", inject "Welcome back" */
#login-form .form-header {
    font-size: 0 !important;
    line-height: 0 !important;
    margin-bottom: 0 !important;
    display: block !important;
}

#login-form .form-header::before {
    content: "Welcome back";
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

#login-form .form-header::after {
    content: "Sign in to access your PSI Connect dashboard.";
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 6px;
    margin-bottom: 24px;
}

/* Field labels */
#login-form #form-content .form-group:nth-child(1)::before {
    content: "Username";
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

#login-form #form-content .form-group:nth-child(2)::before {
    content: "Password";
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

/* Inputs */
#login-form .form-control {
    border: 1.5px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 10px 14px 10px 40px !important;
    font-size: 14px !important;
    color: #111827 !important;
    background-color: #f9fafb !important;
    height: 44px !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#login-form .form-control:focus {
    border-color: #1888ff !important;
    box-shadow: 0 0 0 3px rgba(24, 136, 255, 0.12) !important;
    background-color: #ffffff !important;
    outline: none !important;
}

#login-form .form-control::placeholder {
    color: #9ca3af !important;
    opacity: 1 !important;
}

/* Username: person icon + space for dropdown toggle */
#username {
    background-color: #f9fafb !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 12px center !important;
    background-size: 16px !important;
    padding-right: 50px !important;
}

/* Password: lock icon */
#user-pass {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 12px center !important;
    background-size: 16px !important;
}

/* Restore the relative container the original CSS provided */
#login-form #user-identification-wrapper {
    position: relative !important;
}

/* Dropdown toggle — must be absolute to overlay the right edge of the username input */
#user-dropdown-toggle {
    position: absolute !important;
    right: 0 !important;
    top: 0 !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 0 8px 8px 0 !important;
    background-color: #1888ff !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}

#user-dropdown-toggle::after {
    margin: 0 !important;
}

#user-dropdown {
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12) !important;
    border: 1px solid #e5e7eb !important;
    overflow: hidden !important;
    margin-top: 4px !important;
}

/* Login button */
#submit-button {
    margin-top: 8px !important;
    background-color: #1888ff !important;
    border-color: #1888ff !important;
    border-radius: 8px !important;
    width: 100% !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    height: 44px !important;
    letter-spacing: 0.2px;
    transition: background-color 0.15s;
}

#submit-button:hover {
    background-color: #0e6fd8 !important;
    border-color: #0e6fd8 !important;
}

#login-form .form-group > #error-message {
    min-height: 0 !important;
    border-radius: 8px !important;
}

/* ============================================
   CONTEXT MODAL
   ============================================ */
#context-modal {
    background: linear-gradient(to right, #0d1b2e 50%, #eef1f5 50%) !important;
}

/* Logo panel inside modal (absolute within the fixed modal) */
#context-modal > .stsoftwarelogo {
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 50% !important;
    height: 100% !important;
    padding: 0 !important;
    background-image: url('/img/login-background.png') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: cover !important;
}

/* Logo centered with 10% padding on all sides */
#context-modal > .stsoftwarelogo::before {
    content: '' !important;
    position: absolute !important;
    left: 10% !important;
    right: 10% !important;
    top: 10% !important;
    bottom: 10% !important;
    background-image: url('/img/logo.svg') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;
}

#context-modal > .stsoftwarelogo img {
    display: none !important;
}

/* Context form card */
#context-modal > #context-form-wrapper {
    position: absolute !important;
    top: 50% !important;
    left: 75% !important;
    transform: translate(-50%, -50%) !important;
    width: min(440px, 44%) !important;
    min-width: 300px;
    background: #ffffff !important;
    border-radius: 14px !important;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.14) !important;
    padding: 40px !important;
    padding-bottom: 40px !important;
}

#context-form {
    padding: 0 !important;
}

#context-form > #title-seperator {
    display: none !important;
}

/* Context form header: hide "Select Context", inject styled version */
#context-form .form-header {
    font-size: 0 !important;
    line-height: 0 !important;
    margin-bottom: 0 !important;
    display: block !important;
}

#context-form .form-header::before {
    content: "Select Context";
    display: block;
    font-size: 26px;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

#context-form .form-header::after {
    content: "Choose your workspace to continue.";
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.5;
    margin-top: 6px;
    margin-bottom: 24px;
}

/* Context label */
#context-form #form-content .form-group:nth-child(1)::before {
    content: "Workspace";
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
}

/* Context select dropdown */
#context-select {
    border: 1.5px solid #e5e7eb !important;
    border-radius: 8px !important;
    padding: 10px 14px !important;
    font-size: 14px !important;
    color: #111827 !important;
    background-color: #f9fafb !important;
    height: 44px !important;
    width: 100% !important;
    min-width: 100% !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#context-select:focus {
    border-color: #1888ff !important;
    box-shadow: 0 0 0 3px rgba(24, 136, 255, 0.12) !important;
    background-color: #ffffff !important;
    outline: none !important;
}

/* Confirm button */
#btncontextlogin {
    margin-top: 8px !important;
    background-color: #1888ff !important;
    border-color: #1888ff !important;
    border-radius: 8px !important;
    width: 100% !important;
    color: #ffffff !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    height: 44px !important;
    transition: background-color 0.15s;
}

#btncontextlogin:hover {
    background-color: #0e6fd8 !important;
    border-color: #0e6fd8 !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Landscape short screens */
@media screen and (max-height: 600px) and (orientation: landscape) {
    body > .stsoftwarelogo,
    #context-modal > .stsoftwarelogo {
        display: none !important;
    }

    body.stws-index-background {
        background: #eef1f5 !important;
    }

    #context-modal {
        background: #eef1f5 !important;
    }

    #login-form-wrapper {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }

    #context-modal > #context-form-wrapper {
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
    }
}

/* Mobile: stack logo above card */
@media (max-width: 900px) {
    body.stws-index-background {
        background: #eef1f5 !important;
        height: auto !important;
        overflow-y: auto !important;
    }

    body > .stsoftwarelogo {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 160px !important;
        background-color: #0d1b2e !important;
        padding: 28px !important;
    }

    #login-form-wrapper {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: calc(100% - 32px) !important;
        max-width: 440px !important;
        min-width: 0 !important;
        margin: 24px auto 40px !important;
        padding: 28px !important;
    }

    #context-modal {
        background: #eef1f5 !important;
        overflow-y: auto !important;
        display: flex !important;
        flex-direction: column !important;
    }

    #context-modal > .stsoftwarelogo {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 160px !important;
        background-color: #0d1b2e !important;
        flex-shrink: 0;
    }

    #context-modal > #context-form-wrapper {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        width: calc(100% - 32px) !important;
        max-width: 440px !important;
        min-width: 0 !important;
        margin: 24px auto 40px !important;
        padding: 28px !important;
    }
}
